As the abilities of computers expand into entertainment genres that once required separate electronic components, increased efficiency and user-friendliness is desirable. One solution is Microsoft's® DirectShow®, which provides playback of multimedia streams from local files or Internet servers, capture of multimedia streams from devices, and format conversion of multimedia streams. DirectShow enables playback of video and audio content of file types such as MPEG, Apple® QuickTime®, Audio-Video Interleaved (AVI), and WAV.
DirectShow includes a system of pluggable filter components. Filters are objects that support DirectShow interfaces and can operate on streams of data by reading, copying, modifying and writing data to a file. The basic types of filters include a source filter, which takes the data from some source, such as a file on disk, a satellite feed, an Internet server, or a VCR, and introduces it into the filter graph which is a connection of filters. The filter graph provides a transform filter, which converts the format of the data, a sink and source filter which receives data and transmits the data; and a rendering filter, which renders the data, such as rendering the data to a display device. The data could also be rendered to any location that accepts media. Other types of filters included in DirectShow include effect filters, which add effects without changing the data type, and parser filters, which understand the format of the source data and know how to read the correct bytes, create times stamps, and perform seeks.
Therefore, all data passes from filter to filter along with a good deal of control information. When filters are connected using the pins, a filter graph is created. To control the data flow and connections in a filter graph, DirectShow includes a filter graph manager. The filter graph manager assists in assuring that filters are connected in the proper order, but the data and much of the control do not pass through the filter graph manager. Filters must be linked appropriately. For example, the filter graph manager must search for a rendering configuration, determine the types of filters available, link the filters appropriate for a given data type and provide an appropriate rendering filter.
Although filters allow a great deal of reuse of programs, the use of filters also creates unanticipated problems. One of the problems created by filters is the large number of application programming interfaces (APIs) required by the filters. Each filter essentially has a separate API. Therefore, a given filter must be capable of interfacing to an API for every filter to which the filter might attach. Also, the use of filters makes the problem of shutting down a given filter problematic. When a given filter in a graph is shut down, any filter interfacing with the given filter must shut down any associated interfaces. In general, programming a filter to gracefully handle the loss of an interface is difficult as the state of the filter can be unknown when the interface is lost. The loss of interfaces therefore tends to lead to unpredicted behavior in the filters and ultimately to ill-behaved programs. What is needed is a system and method and associated data structures and interfaces that avoid unpredicted behavior.